<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>博客详情页</title>
		<link rel="stylesheet" href="css/common.css">
		<link rel="stylesheet" href="css/blog_detail.css">

		<!-- 引入 jquery -->
		<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

		<!-- 引入 editor.md 依赖 -->
		<link rel="stylesheet" href="editor.md/css/editormd.min.css" />
		<script src="editor.md/lib/marked.min.js"></script>
		<script src="editor.md/lib/prettify.min.js"></script>
		<script src="editor.md/editormd.js"></script>
	</head>
	<body>
		<div class="nav">
			<img src="image/333.jpg" alt="">
			<div class="title">我的博客系统</div>
			<div class="spacer"></div>
			<a href="blog_list.html">主页</a>
			<a href="blog_edit.html">写博客</a>
			<a href="logout">注销</a>
		</div>
	<div class="container">
		<div class="container-left">
			<div class="card">
				<img src="image/222.jpg" alt="">
				<h3></h3>
				<a href="https://www.github.com">github 地址</a>
				<div class="counter">
					<span>文章</span>
					<span>分类</span>
				</div>
				<div class="counter">
					<span>2</span>
					<span>1</span>
				</div>
			</div>
		</div>
		<div class="container-right">
			<h3></h3>
			<div class="date"></div>
			<div id="content">
			</div>
		</div>
	</div>
	<script src="js/app.js"></script>
	<script>
	        function getBlog() {
	            $.ajax({
	                type: 'get',
	                url: 'blog' + location.search,
	                success: function(body) {
	                    let h3 = document.querySelector('.container-right h3');
	                    h3.innerHTML = body.title;
	                    let dateDiv = document.querySelector('.container-right .date');
	                    dateDiv.innerHTML = body.postTime;
	                    editormd.markdownToHTML('content', {markdown: body.content});
	                }
	            });
	        }
	        getBlog();
	        getLoginStatus();
	        function getAuthor() {
	            $.ajax({
	                type: 'get',
	                url: 'user' + location.search,
	                success: function(body) {
	                    if (body.userId == 0) {
	                        alert("当前未找到作者信息!");
	                        return;
	                    }
	                    let h3 = document.querySelector('.card h3');
	                    h3.innerHTML = body.username;
	                }
	            });
	        }
	        getAuthor();
	    </script>
	</body>
</html>